import { createRouter, createWebHistory } from "vue-router";
import Home from "@/pages/Home.vue";
import UserInfoEdit from "@/pages/UserInfoEdit.vue";
import Team from "@/pages/Team.vue";
import SearchPage from "@/pages/SearchPage.vue";
import SearchResults from "@/pages/SearchResults.vue";
import UserLogin from "@/pages/UserLogin.vue";
import TeamAddPage from "@/pages/TeamAddPage.vue";
import TeamUpdatePage from "@/pages/TeamUpdatePage.vue";
import UserPage from "@/pages/UserPage.vue";
import UserInfo from "@/pages/UserInfo.vue";
import UserJoinTeam from "@/pages/UserJoinTeam.vue";
import UserCreateTeam from "@/pages/UserCreateTeam.vue";

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/home",
      component: Home,
      meta: {
        title: "主页",
      },
    },
    {
      path: "/user",
      component: UserPage,
      meta: {
        title: "个人中心",
      },
    },
    {
      path: "/user/edit",
      component: UserInfoEdit,
      meta: {
        title: "信息编辑",
      },
    },
    {
      path: "/user/info",
      component: UserInfo,
      meta: {
        title: "个人信息",
      },
    },
    {
      path: "/user/team/join",
      component: UserJoinTeam,
      meta: {
        title: "个人加入队伍",
      },
    },
    {
      path: "/user/team/create",
      component: UserCreateTeam,
      meta: {
        title: "个人创建队伍",
      },
    },
    {
      path: "/team",
      component: Team,
      meta: {
        title: "找队伍",
      },
    },
    {
      path: "/team/add",
      component: TeamAddPage,
      meta: {
        title: "创建队伍",
      },
    },
    {
      path: "/team/update",
      component: TeamUpdatePage,
      meta: {
        title: "修改队伍信息",
      },
    },
    {
      path: "/search",
      component: SearchPage,
      meta: {
        title: "搜索用户",
      },
    },
    {
      path: "/user/list",
      component: SearchResults,
      meta: {
        title: "用户列表",
      },
    },
    {
      path: "/user/login",
      component: UserLogin,
      meta: {
        title: "登录",
      },
    },
    {
      path: "/",
      redirect: "/home",
    },
  ],
});

export default router;
